import math


class Shape:
  def __init__(self, name):
    self.name = name

  def getName(self):
    return self.name

  def area(self):
    pass


class Rectangle(Shape):
  def __init__(self, a, b, name):
    super().__init__(name)
    self.a = a
    self.b = b

  def area(self):
    return self.a * self.b


class Circle(Shape):

  def __init__(self, r, name):
    super().__init__(name)
    self.r = r

  def area(self):
    return (math.pi) * self.r ** 2


r1 = Rectangle(3, 4, "矩形")
c1 = Circle(5, "圆形")

shapes = [r1, c1]

for i in shapes:
  i.area()
  print(f"{i.getName()}的面积是{i.area()}")


# print(f"{c1.name}的面积是{c1.area()}")
